<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta name="description" content="C++ STL模板包含了很多数据结构和算法，刷题中经常也会用到，本文介绍了STL里面的容器部分。看了很多牛人的博客之后，感觉自己对STL的理解还是比较浅显的，特此重新更新了一章，STL内部数据结构来说明STL中使用的数据结构。">
<meta property="og:type" content="article">
<meta property="og:title" content="C++之STL用法">
<meta property="og:url" content="http://luqilinok.github.io/2019/07/11/cplusplusstl/index.html">
<meta property="og:site_name" content="Lu QiLin&#39;s Blog">
<meta property="og:description" content="C++ STL模板包含了很多数据结构和算法，刷题中经常也会用到，本文介绍了STL里面的容器部分。看了很多牛人的博客之后，感觉自己对STL的理解还是比较浅显的，特此重新更新了一章，STL内部数据结构来说明STL中使用的数据结构。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-07-19T02:00:31.640Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="C++之STL用法">
<meta name="twitter:description" content="C++ STL模板包含了很多数据结构和算法，刷题中经常也会用到，本文介绍了STL里面的容器部分。看了很多牛人的博客之后，感觉自己对STL的理解还是比较浅显的，特此重新更新了一章，STL内部数据结构来说明STL中使用的数据结构。">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://luqilinok.github.io/2019/07/11/cplusplusstl/">





  <title>C++之STL用法 | Lu QiLin's Blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Lu QiLin's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-technology">
          <a href="/categories/Technology/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            Technology
          </a>
        </li>
      
        
        <li class="menu-item menu-item-notes">
          <a href="/categories/Notes/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            Notes
          </a>
        </li>
      
        
        <li class="menu-item menu-item-personal">
          <a href="/categories/Personal/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            Personal
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            About
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://luqilinok.github.io/2019/07/11/cplusplusstl/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="LuQiLin">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Lu QiLin's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">C++之STL用法</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2019-07-11T08:45:13+08:00">
                2019-07-11
              </time>
            

            

            
          </span>
          
  <span class="post-updated">
    &nbsp; | &nbsp; 更新于
    <time itemprop="dateUpdated" datetime="2019-07-19T10:00:31+08:00" content="2019-07-19">
      2019-07-19
    </time>
  </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Notes/" itemprop="url" rel="index">
                    <span itemprop="name">Notes</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>C++ STL模板包含了很多数据结构和算法，刷题中经常也会用到，本文介绍了STL里面的容器部分。看了很多牛人的博客之后，感觉自己对STL的理解还是比较浅显的，特此重新更新了一章，STL内部数据结构来说明STL中使用的数据结构。</p>
<a id="more"></a>
<hr>
<h1 id="STL容器"><a href="#STL容器" class="headerlink" title="STL容器"></a>STL容器</h1><p>· 顺序容器</p>
<ul>
<li>vector：尾端插入元素有较高性能，动态数组实现；</li>
<li>deque：首尾插入元素都有较高性能，动态数据实现；</li>
<li>list：可以常数时间在任何地方插入元素，链表实现；</li>
</ul>
<p>· 关联容器</p>
<ul>
<li>set：不同元素的集合，平衡二叉树实现，检索时间是O(long(N))</li>
<li>multiset：同上，可以包含相同元数据；</li>
<li>map：同set，但存放的是键值对</li>
<li>mutimap：同上，键可以重复</li>
</ul>
<p>· 容器适配器：stack，queue，priority_queue</p>
<hr>
<h1 id="vector"><a href="#vector" class="headerlink" title="vector"></a>vector</h1><h2 id="特点"><a href="#特点" class="headerlink" title="特点"></a>特点</h2><p>将一个元素置于一个动态数组中加以管理，可以随机存取元素。在数组尾部添加或删除元素非常快速，但是在中部或头部插入或删除元素比较耗时。</p>
<h2 id="方法"><a href="#方法" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">push_back</td>
<td style="text-align:left">在数组的最后添加一个数据, 示例： c.push_back(5);</td>
</tr>
<tr>
<td style="text-align:center">pop_back</td>
<td style="text-align:left">去掉数组的最后一个数据, 示例：c.pop_back();</td>
</tr>
<tr>
<td style="text-align:center">at</td>
<td style="text-align:left">得到编号位置的数据， 示例： int d = c.at(0);</td>
</tr>
<tr>
<td style="text-align:center">begin</td>
<td style="text-align:left">得到数组头的指针, 示例： vector::iterator it = c.begin();</td>
</tr>
<tr>
<td style="text-align:center">end</td>
<td style="text-align:left">得到数组的最后一个单元+1的指针, 示例： vector::iterator it = c.end();</td>
</tr>
<tr>
<td style="text-align:center">front</td>
<td style="text-align:left">得到数组头的引用, 示例： int first = c.front();</td>
</tr>
<tr>
<td style="text-align:center">back</td>
<td style="text-align:left">得到数组的最后一个单元的引用, 示例： int last = c.back();</td>
</tr>
<tr>
<td style="text-align:center">max_size</td>
<td style="text-align:left">得到vector最大可以是多大</td>
</tr>
<tr>
<td style="text-align:center">capacity</td>
<td style="text-align:left">当前vector分配的大小</td>
</tr>
<tr>
<td style="text-align:center">size</td>
<td style="text-align:left">当前使用数据的大小</td>
</tr>
<tr>
<td style="text-align:center">resize</td>
<td style="text-align:left">改变当前使用数据的大小，如果它比当前使用的大，则填充默认值</td>
</tr>
<tr>
<td style="text-align:center">reserve</td>
<td style="text-align:left">改变当前vecotr所分配空间的大小</td>
</tr>
<tr>
<td style="text-align:center">erase</td>
<td style="text-align:left">删除指针指向的数据项</td>
</tr>
<tr>
<td style="text-align:center">clear</td>
<td style="text-align:left">清空当前的vector</td>
</tr>
<tr>
<td style="text-align:center">rbegin</td>
<td style="text-align:left">将vector反转后的开始指针返回(其实就是原来的end-1)</td>
</tr>
<tr>
<td style="text-align:center">rend</td>
<td style="text-align:left">将vector反转后的结束指针返回(其实就是原来的begin-1)</td>
</tr>
<tr>
<td style="text-align:center">empty</td>
<td style="text-align:left">判断vector是否为空</td>
</tr>
<tr>
<td style="text-align:center">swap</td>
<td style="text-align:left">与另一个vector交换数据</td>
</tr>
</tbody>
</table>
<h2 id="使用示例"><a href="#使用示例" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">VectorTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="comment">// 初始化</span></span><br><span class="line">        <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt; v1;</span><br><span class="line">        <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt; v2(<span class="number">10</span>, <span class="number">6</span>);</span><br><span class="line">        <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt; v3(v2.begin(), v2.end());</span><br><span class="line">        print(v1);</span><br><span class="line">        print(v2);</span><br><span class="line">        print(v3);</span><br><span class="line">        <span class="comment">// 插入数据</span></span><br><span class="line">        v1.push_back(<span class="number">1</span>);</span><br><span class="line">        v1.push_back(<span class="number">2</span>);</span><br><span class="line">        v1.insert(v1.begin(), <span class="number">3</span>);</span><br><span class="line">        v1.insert(v1.begin() + <span class="number">1</span>, v2.begin(), v2.end());</span><br><span class="line">        print(v1);</span><br><span class="line">        <span class="comment">// 赋值函数</span></span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"capacity:"</span> &lt;&lt; v2.capacity() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        v2.assign(<span class="number">8</span>, <span class="number">1</span>);</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"capacity:"</span> &lt;&lt; v2.capacity() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        print(v2);</span><br><span class="line">        <span class="comment">// 引用函数</span></span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; v3.front() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; v3.back() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        v3.at(<span class="number">4</span>) = <span class="number">5</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; v3.at(<span class="number">4</span>) &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="comment">// 移出和删除</span></span><br><span class="line">        v1.pop_back();</span><br><span class="line">        v1.erase(v1.begin() + <span class="number">1</span>);</span><br><span class="line">        print(v1);</span><br><span class="line">        <span class="comment">// 大小</span></span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"capacity: "</span> &lt;&lt; v1.capacity() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"size: "</span> &lt;&lt; v1.size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"max_size: "</span> &lt;&lt; v1.max_size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        v1.clear();</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"after clear"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"capacity: "</span> &lt;&lt; v1.capacity() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"size: "</span> &lt;&lt; v1.size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"max_size: "</span> &lt;&lt; v1.max_size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="comment">// 强制清除v1内存</span></span><br><span class="line">        <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt;().swap(v1);</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"capacity: "</span> &lt;&lt; v1.capacity() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"size: "</span> &lt;&lt; v1.size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"max_size: "</span> &lt;&lt; v1.max_size() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(<span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt; vi)</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt;::iterator it = vi.begin(); it != vi.end(); ++it)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; *it &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">6 6 6 6 6 6 6 6 6 6</span><br><span class="line">6 6 6 6 6 6 6 6 6 6</span><br><span class="line">3 6 6 6 6 6 6 6 6 6 6 1 2</span><br><span class="line">capacity:10</span><br><span class="line">capacity:10</span><br><span class="line">1 1 1 1 1 1 1 1</span><br><span class="line">6</span><br><span class="line">6</span><br><span class="line">5</span><br><span class="line">3 6 6 6 6 6 6 6 6 6 1</span><br><span class="line">capacity: 13</span><br><span class="line">size: 11</span><br><span class="line">max_size: 1073741823</span><br><span class="line">after clear</span><br><span class="line">capacity: 13</span><br><span class="line">size: 0</span><br><span class="line">max_size: 1073741823</span><br><span class="line">capacity: 0</span><br><span class="line">size: 0</span><br><span class="line">max_size: 1073741823</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="deque"><a href="#deque" class="headerlink" title="deque"></a>deque</h1><h2 id="特点-1"><a href="#特点-1" class="headerlink" title="特点"></a>特点</h2><p>“double-ended queue” 双端队列，可以随机存取。数组尾部或头部添加或删除元素非常快速，但在中部插入或删除元素比较费时。</p>
<ul>
<li>随机访问方便，即支持 [ ] 操作符和vector.at() ，但性能没有vector 好；</li>
<li>可以在内部进行插入和删除操作，但性能不及list ；</li>
<li>可以在两端进行push 、pop ；</li>
<li>相对于verctor 占用更多的内存。</li>
</ul>
<h2 id="方法-1"><a href="#方法-1" class="headerlink" title="方法"></a>方法</h2><p>相同于vector，<strong>新增</strong>了push_front和pop_front方法</p>
<table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">push_front</td>
<td style="text-align:left">在头部加入一个元素</td>
</tr>
<tr>
<td style="text-align:center">pop_front</td>
<td style="text-align:left">删除头部元素</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-1"><a href="#使用示例-1" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">DequeTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="comment">// 初始化</span></span><br><span class="line">        <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt; d1;</span><br><span class="line">        <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt; d2(<span class="number">20</span>, <span class="number">1</span>);</span><br><span class="line">        <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt; d3(d2);</span><br><span class="line">        <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt; d4(d3.begin(), d3.end());</span><br><span class="line"></span><br><span class="line">        print(d1);</span><br><span class="line">        print(d2);</span><br><span class="line">        print(d3);</span><br><span class="line">        print(d4);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 插入</span></span><br><span class="line">        d1.push_back(<span class="number">5</span>);</span><br><span class="line">        d1.push_back(<span class="number">7</span>);</span><br><span class="line">        d1.push_front(<span class="number">6</span>);</span><br><span class="line">        print(d1);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 查找</span></span><br><span class="line">        <span class="keyword">const</span> <span class="keyword">int</span> findnum = <span class="number">6</span>;</span><br><span class="line">        <span class="keyword">auto</span> pos = find(d1.begin(), d1.end(), findnum);</span><br><span class="line">        <span class="keyword">if</span> (pos != d1.end())</span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">"find %d success\n"</span>, findnum);</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">"find failed\n"</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 删除</span></span><br><span class="line">        d1.pop_back();</span><br><span class="line">        d1.pop_front();</span><br><span class="line">        print(d1);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(<span class="keyword">const</span> <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt; di)</span> <span class="keyword">const</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt;::const_iterator cit = di.cbegin(); cit != di.cend(); ++cit)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; *cit &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</span><br><span class="line">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</span><br><span class="line">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</span><br><span class="line">6 5 7</span><br><span class="line">find 6 success</span><br><span class="line">5</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="list"><a href="#list" class="headerlink" title="list"></a>list</h1><h2 id="特点-2"><a href="#特点-2" class="headerlink" title="特点"></a>特点</h2><p>双向链表，不提供随机存取（按顺序存储），在任何位置插入或删除动作都非常迅速。只能顺序访问（从前向后或者从后向前）。与前面两种容器类有一个明显的区别就是：它不支持随机访问。要访问表中某个下标处的项需要从表头或表尾处（接近该下标的一端）开始循环。而且缺少下标预算符：operator[]。</p>
<h2 id="方法-2"><a href="#方法-2" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">merge</td>
<td style="text-align:left">合并两个list</td>
</tr>
<tr>
<td style="text-align:center">remove_if</td>
<td style="text-align:left">按条件删除元素</td>
</tr>
<tr>
<td style="text-align:center">sort</td>
<td style="text-align:left">给list排序</td>
</tr>
<tr>
<td style="text-align:center">splice</td>
<td style="text-align:left">合并两个list,源list的内容部分或全部元素删除，拼插入到目的list</td>
</tr>
<tr>
<td style="text-align:center">unique</td>
<td style="text-align:left">删除list中重复的元素</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-2"><a href="#使用示例-2" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">ListTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt; l1;</span><br><span class="line">        <span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt; l2(<span class="number">5</span>);</span><br><span class="line">        <span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt; l3(<span class="number">2</span>, <span class="number">3</span>);</span><br><span class="line">        <span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt; l4(l3.begin(), l3.end());</span><br><span class="line"></span><br><span class="line">        print(l1);</span><br><span class="line">        print(l2);</span><br><span class="line">        print(l3);</span><br><span class="line">        print(l4);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 插入</span></span><br><span class="line">        l1.push_back(<span class="number">5</span>);</span><br><span class="line">        l1.push_front(<span class="number">6</span>);</span><br><span class="line">        l1.push_back(<span class="number">7</span>);</span><br><span class="line"></span><br><span class="line">        print(l1);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 累加算法</span></span><br><span class="line">        <span class="keyword">int</span> result = accumulate(l1.begin(), l1.end(), <span class="number">0</span>);</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"sum = "</span> &lt;&lt; result &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 求最大值</span></span><br><span class="line">        <span class="keyword">auto</span> max_num = max_element(l1.begin(), l1.end());</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"the maximum element in l1 is "</span> &lt;&lt; *max_num &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(<span class="keyword">const</span> <span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt; &amp;li)</span> <span class="keyword">const</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="built_in">list</span>&lt;<span class="keyword">int</span>&gt;::const_iterator cit = li.cbegin(); cit != li.cend();</span><br><span class="line">             ++cit)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; *cit &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">0 0 0 0 0</span><br><span class="line">3 3</span><br><span class="line">3 3</span><br><span class="line">6 5 7</span><br><span class="line">sum = 18</span><br><span class="line">the maximum element in l1 is 7</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="map"><a href="#map" class="headerlink" title="map"></a>map</h1><h2 id="特点-3"><a href="#特点-3" class="headerlink" title="特点"></a>特点</h2><p>Map的元素是成对的键值/实值，内部的元素依据其值<strong>自动排序</strong>，Map内的相同数值的元素只能出现一次，map就是一个容器，里面装的就是若干个pair。每个pair的第一个元素，称为键（注意键的类型必须支持小于(&lt;)操作），第二个元素，称为值。对于普通的map，每个键都对应一个值。这样的看起来，键类似于数组的下标，而值类似于数组的值。map类定义了3种类型，分别为key_type、mapped_type以及vaule_type。他们分别表示了键的类型、值的类型，以及一个pair类型，pair的第一个元素是键，第二个元素是值。</p>
<h2 id="方法-3"><a href="#方法-3" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">at</td>
<td style="text-align:left">取出对应键值的元素</td>
</tr>
<tr>
<td style="text-align:center">count</td>
<td style="text-align:left">返回指定键值的元素个数，在map中只能是0或者1</td>
</tr>
<tr>
<td style="text-align:center">find</td>
<td style="text-align:left">如果k在m中的键值存在则返回相应的迭代器，否则返回超出来末端迭代器</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-3"><a href="#使用示例-3" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">MapTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="built_in">map</span>&lt;<span class="built_in">string</span>, <span class="keyword">int</span>&gt; m1;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 插入</span></span><br><span class="line">        m1[<span class="string">"Peter"</span>] = <span class="number">1</span>;</span><br><span class="line">        m1[<span class="string">"Alice"</span>] = <span class="number">3</span>;</span><br><span class="line">        m1.insert(<span class="built_in">map</span>&lt;<span class="built_in">string</span>, <span class="keyword">int</span>&gt;::value_type(<span class="string">"Bob"</span>, <span class="number">2</span>));</span><br><span class="line">        print(m1);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 查找</span></span><br><span class="line">        <span class="keyword">auto</span> it = m1.find(<span class="string">"Bob"</span>);</span><br><span class="line">        <span class="keyword">if</span> (it != m1.end())</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"find success "</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"find failed"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 统计</span></span><br><span class="line">        <span class="keyword">int</span> result = m1.count(<span class="string">"Bob"</span>);</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"result: "</span> &lt;&lt; result &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 删除</span></span><br><span class="line">        <span class="keyword">int</span> ret = m1.erase(<span class="string">"Bob"</span>);</span><br><span class="line">        <span class="keyword">if</span> (ret)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"remove success"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"can't find"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">auto</span> iter = m1.erase(m1.begin());</span><br><span class="line">        print(m1);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(<span class="keyword">const</span> <span class="built_in">map</span>&lt;<span class="built_in">string</span>, <span class="keyword">int</span>&gt; &amp;m)</span> <span class="keyword">const</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="built_in">map</span>&lt;<span class="built_in">string</span>, <span class="keyword">int</span>&gt;::const_iterator cit = m.cbegin(); cit != m.cend();</span><br><span class="line">             ++cit)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; (*cit).first &lt;&lt; <span class="string">":"</span> &lt;&lt; (*cit).second &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">Alice:3</span><br><span class="line">Bob:2</span><br><span class="line">Peter:1</span><br><span class="line">find success</span><br><span class="line">result: 1</span><br><span class="line">remove success</span><br><span class="line">Peter:1</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="set"><a href="#set" class="headerlink" title="set"></a>set</h1><h2 id="特点-4"><a href="#特点-4" class="headerlink" title="特点"></a>特点</h2><p>set只有键，没有值，所以他的vaule_type不是pair类型，而是key_type类型。同样的，它也支持insert、find、count操作。<strong>map比较适合于储存键值对应的情况，而set适合于储存键，判断键在不在这个集合中，比如黑名单之类的</strong>。</p>
<h2 id="方法-4"><a href="#方法-4" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">at</td>
<td style="text-align:left">取出对应键值的元素</td>
</tr>
<tr>
<td style="text-align:center">count</td>
<td style="text-align:left">返回指定键值的元素个数，在map中只能是0或者1</td>
</tr>
<tr>
<td style="text-align:center">find</td>
<td style="text-align:left">如果k在m中的键值存在则返回相应的迭代器，否则返回超出来末端迭代器</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-4"><a href="#使用示例-4" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">SetTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="comment">// 初始化</span></span><br><span class="line">        <span class="built_in">set</span>&lt;<span class="built_in">string</span>&gt; s;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 插入</span></span><br><span class="line">        s.insert(<span class="string">"Peter"</span>);</span><br><span class="line">        s.insert(<span class="string">"Bob"</span>);</span><br><span class="line">        pair&lt;<span class="built_in">set</span>&lt;<span class="built_in">string</span>&gt;::iterator, <span class="keyword">bool</span>&gt; ret = s.insert(<span class="string">"Peter"</span>);</span><br><span class="line">        <span class="keyword">if</span> (ret.second)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"insert success"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"the word exists"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        print(s);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 查找</span></span><br><span class="line">        <span class="built_in">set</span>&lt;<span class="built_in">string</span>&gt;::iterator iter = s.find(<span class="string">"Bob"</span>);</span><br><span class="line">        <span class="keyword">if</span> (iter != s.end())</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"find success"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; <span class="string">"failed find"</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 统计</span></span><br><span class="line">        <span class="keyword">int</span> result = s.count(<span class="string">"Peter"</span>);</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"result"</span> &lt;&lt; result &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(<span class="keyword">const</span> <span class="built_in">set</span>&lt;<span class="built_in">string</span>&gt; &amp;s)</span> <span class="keyword">const</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="built_in">set</span>&lt;<span class="built_in">string</span>&gt;::const_iterator cit = s.begin(); cit != s.end();</span><br><span class="line">             ++cit)</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; *cit &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">the word exists</span><br><span class="line">Bob Peter</span><br><span class="line">find success</span><br><span class="line">result1</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="multimap"><a href="#multimap" class="headerlink" title="multimap"></a>multimap</h1><p>使用方法同map</p>
<hr>
<h1 id="multiset"><a href="#multiset" class="headerlink" title="multiset"></a>multiset</h1><p>使用方法同set</p>
<hr>
<h1 id="stack"><a href="#stack" class="headerlink" title="stack"></a>stack</h1><h2 id="特点-5"><a href="#特点-5" class="headerlink" title="特点"></a>特点</h2><p>可以使用三种顺序容器vector、deque（默认）中的任何一个作为stack的底层模型</p>
<h2 id="方法-5"><a href="#方法-5" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">empty</td>
<td style="text-align:left">判断栈是否为空</td>
</tr>
<tr>
<td style="text-align:center">push</td>
<td style="text-align:left">压入一个数据</td>
</tr>
<tr>
<td style="text-align:center">pop</td>
<td style="text-align:left">弹出一个数据</td>
</tr>
<tr>
<td style="text-align:center">size</td>
<td style="text-align:left">返回栈的长度</td>
</tr>
<tr>
<td style="text-align:center">top</td>
<td style="text-align:left">得到栈顶数据</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-5"><a href="#使用示例-5" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">StackTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="comment">// 初始化</span></span><br><span class="line">        <span class="built_in">stack</span>&lt;<span class="keyword">int</span>&gt; sDeque;</span><br><span class="line">        <span class="built_in">stack</span>&lt;<span class="keyword">int</span>, <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt;&gt; sVector;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// push</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">10</span>; ++i)</span><br><span class="line">            sDeque.push(i);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// pop</span></span><br><span class="line">        <span class="keyword">while</span> (!sDeque.empty())</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; sDeque.top() &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">            sDeque.pop();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<h2 id="运行结果"><a href="#运行结果" class="headerlink" title="运行结果"></a>运行结果</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">9 8 7 6 5 4 3 2 1 0</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="queue"><a href="#queue" class="headerlink" title="queue"></a>queue</h1><h2 id="特点-6"><a href="#特点-6" class="headerlink" title="特点"></a>特点</h2><p>可以使用deque（默认）或vector作为底层容器</p>
<h2 id="方法-6"><a href="#方法-6" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">push</td>
<td style="text-align:left">将一个元素输入放到队列</td>
</tr>
<tr>
<td style="text-align:center">pop</td>
<td style="text-align:left">取出一个元素</td>
</tr>
<tr>
<td style="text-align:center">back</td>
<td style="text-align:left">队尾元素</td>
</tr>
<tr>
<td style="text-align:center">front</td>
<td style="text-align:left">队头元素</td>
</tr>
<tr>
<td style="text-align:center">size</td>
<td style="text-align:left">队列长度</td>
</tr>
<tr>
<td style="text-align:center">empty</td>
<td style="text-align:left">判断队列是否为空</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-6"><a href="#使用示例-6" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">QueueTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        <span class="built_in">queue</span>&lt;<span class="keyword">int</span>&gt; q;</span><br><span class="line">        <span class="built_in">queue</span>&lt;<span class="keyword">int</span>, <span class="built_in">vector</span>&lt;<span class="keyword">int</span>&gt;&gt; qVector;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// push</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">10</span>; ++i)</span><br><span class="line">            q.push(i);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// back &amp; front</span></span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"back: "</span> &lt;&lt; q.back() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="string">"front: "</span> &lt;&lt; q.front() &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// pop</span></span><br><span class="line">        <span class="keyword">while</span> (!q.empty())</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; q.front() &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">            q.pop();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">back: 9</span><br><span class="line">front: 0</span><br><span class="line">0 1 2 3 4 5 6 7 8 9</span><br></pre></td></tr></table></figure>
<hr>
<h1 id="priority-queue"><a href="#priority-queue" class="headerlink" title="priority_queue"></a>priority_queue</h1><h2 id="特点-7"><a href="#特点-7" class="headerlink" title="特点"></a>特点</h2><p> priority_queue也是一个队列，其元素按有序顺序排列。其不采用严格的 FIFO 顺序，给定时刻位于队头的元素正是有最高优先级的元素。如果两个元素有相同的优先级，那么它们在队列中的顺序就遵循FIFO语义。默认适配的底层容器是vector，也可以使用deque，list不能用，因为priority_queue要求能对元素随机访问以便进行排序。</p>
<h2 id="方法-7"><a href="#方法-7" class="headerlink" title="方法"></a>方法</h2><table>
<thead>
<tr>
<th style="text-align:center">方法</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">push</td>
<td style="text-align:left">将一个元素输入放到队列</td>
</tr>
<tr>
<td style="text-align:center">pop</td>
<td style="text-align:left">取出一个元素</td>
</tr>
<tr>
<td style="text-align:center">top</td>
<td style="text-align:left">取出优先级最大或最少的元素</td>
</tr>
<tr>
<td style="text-align:center">empty</td>
<td style="text-align:left">判断队列是否为空</td>
</tr>
</tbody>
</table>
<h2 id="使用示例-7"><a href="#使用示例-7" class="headerlink" title="使用示例"></a>使用示例</h2><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">PriorityQueueTest</span></span></span><br><span class="line"><span class="class">&#123;</span></span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="class"><span class="keyword">struct</span> <span class="title">cmp</span></span></span><br><span class="line"><span class="class">    &#123;</span></span><br><span class="line">        <span class="function"><span class="keyword">bool</span> <span class="title">operator</span><span class="params">()</span><span class="params">(<span class="keyword">int</span> &amp;a, <span class="keyword">int</span> &amp;b)</span></span></span><br><span class="line"><span class="function">        </span>&#123;</span><br><span class="line">            <span class="keyword">return</span> a &gt; b;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;;</span><br><span class="line"></span><br><span class="line">    <span class="class"><span class="keyword">struct</span> <span class="title">Node</span></span></span><br><span class="line"><span class="class">    &#123;</span></span><br><span class="line">        <span class="keyword">bool</span> <span class="keyword">operator</span>&lt;(Node &amp;a, Node &amp;b)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">if</span> (a.priority == b.priority)</span><br><span class="line">                <span class="keyword">return</span> a.val &lt; b.val;</span><br><span class="line">            <span class="keyword">return</span> a.priority &lt; b.priority;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">int</span> priority;</span><br><span class="line">        <span class="keyword">int</span> val;</span><br><span class="line">    &#125;;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">Test</span><span class="params">()</span></span></span><br><span class="line"><span class="function">    </span>&#123;</span><br><span class="line">        priority_queue&lt;<span class="keyword">int</span>&gt; maxHeap;</span><br><span class="line">        priority_queue&lt;<span class="keyword">int</span>, <span class="built_in">deque</span>&lt;<span class="keyword">int</span>&gt;, cmp&gt; minHeap;</span><br><span class="line">        priority_queue&lt;Node&gt; NodeHeap;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// push</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">10</span>; ++i)</span><br><span class="line">        &#123;</span><br><span class="line">            maxHeap.push(i);</span><br><span class="line">            minHeap.push(i);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// pop</span></span><br><span class="line">        <span class="keyword">while</span> (!maxHeap.empty())</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; maxHeap.top() &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">            maxHeap.pop();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">        <span class="keyword">while</span> (!minHeap.empty())</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="built_in">cout</span> &lt;&lt; minHeap.top() &lt;&lt; <span class="string">" "</span>;</span><br><span class="line">            minHeap.pop();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">cout</span> &lt;&lt; <span class="built_in">endl</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>运行结果：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">9 8 7 6 5 4 3 2 1 0</span><br><span class="line">0 1 2 3 4 5 6 7 8 9</span><br></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/07/11/cpluscplusnew/" rel="next" title="C++11/14新特性">
                <i class="fa fa-chevron-left"></i> C++11/14新特性
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/07/11/cpluscplusstlcode/" rel="prev" title="C++之STL源码剖析">
                C++之STL源码剖析 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">LuQiLin</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives">
              
                  <span class="site-state-item-count">80</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">1</span>
                  <span class="site-state-item-name">categories</span>
                
              </div>
            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#STL容器"><span class="nav-number">1.</span> <span class="nav-text">STL容器</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#vector"><span class="nav-number">2.</span> <span class="nav-text">vector</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点"><span class="nav-number">2.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法"><span class="nav-number">2.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例"><span class="nav-number">2.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#deque"><span class="nav-number">3.</span> <span class="nav-text">deque</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-1"><span class="nav-number">3.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-1"><span class="nav-number">3.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-1"><span class="nav-number">3.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#list"><span class="nav-number">4.</span> <span class="nav-text">list</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-2"><span class="nav-number">4.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-2"><span class="nav-number">4.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-2"><span class="nav-number">4.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#map"><span class="nav-number">5.</span> <span class="nav-text">map</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-3"><span class="nav-number">5.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-3"><span class="nav-number">5.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-3"><span class="nav-number">5.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#set"><span class="nav-number">6.</span> <span class="nav-text">set</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-4"><span class="nav-number">6.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-4"><span class="nav-number">6.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-4"><span class="nav-number">6.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#multimap"><span class="nav-number">7.</span> <span class="nav-text">multimap</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#multiset"><span class="nav-number">8.</span> <span class="nav-text">multiset</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#stack"><span class="nav-number">9.</span> <span class="nav-text">stack</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-5"><span class="nav-number">9.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-5"><span class="nav-number">9.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-5"><span class="nav-number">9.3.</span> <span class="nav-text">使用示例</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#运行结果"><span class="nav-number">9.4.</span> <span class="nav-text">运行结果</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#queue"><span class="nav-number">10.</span> <span class="nav-text">queue</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-6"><span class="nav-number">10.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-6"><span class="nav-number">10.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-6"><span class="nav-number">10.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#priority-queue"><span class="nav-number">11.</span> <span class="nav-text">priority_queue</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#特点-7"><span class="nav-number">11.1.</span> <span class="nav-text">特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#方法-7"><span class="nav-number">11.2.</span> <span class="nav-text">方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用示例-7"><span class="nav-number">11.3.</span> <span class="nav-text">使用示例</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">LuQiLin</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
